//
//  NSArray+mutableDeepCopy.m
//  SPDataCenter
//
//  Created by KimJeongJin on 2014. 12. 22..
//  Copyright (c) 2014년 OGQ Corp. All rights reserved.
//

#import "NSArray+mutableDeepCopy.h"

@implementation NSArray (mutableDeepCopy)
-(NSMutableArray*)mutableDeepCopy
{
    NSMutableArray* mutableArray = [self mutableCopy];

    for (int i=0;i<[self count];i++)
    {
        id instance = [self objectAtIndex:i];
        if([instance respondsToSelector:@selector(mutableDeepCopy)])
        {
            [mutableArray replaceObjectAtIndex:i withObject:[instance mutableDeepCopy]];
        }
    }

    return mutableArray;
}

- (NSString *)descriptionWithLocale:(id)locale
{
    NSMutableString *strM = [NSMutableString stringWithString:@"(\n"];
    
    [self enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
        [strM appendFormat:@"\t%@,\n", obj];
    }];
    
    [strM appendString:@")"];
    
    return strM;
}
@end


@implementation NSDictionary (Log)

- (NSString *)descriptionWithLocale:(id)locale
{
    NSMutableString *strM = [NSMutableString stringWithString:@"{\n"];
    
    [self enumerateKeysAndObjectsUsingBlock:^(id key, id obj, BOOL *stop) {
        [strM appendFormat:@"\t%@ = %@;\n", key, obj];
    }];
    
    [strM appendString:@"}\n"];
    
    return strM;
}

@end